client.focused          #364670 #364670 #93CFBD #364670 #364670
client.focused_inactive #2F2F38 #2F2F38 #CCCCCC #2F2F38 #2F2F38
client.unfocused        #2F2F38 #2F2F38 #93CFBD #2F2F38 #2F2F38
client.urgent           #6B3659 #6B3659 #93CFBD #6B3659 #6B3659
client.placeholder      #666666 #666666 #CCCCCC #666666 #666666
client.background       #364670

set $mod Mod1
set $border 3 
set $gs 2

smart_gaps on
gaps inner 5 
gaps outer 0 

# new_window pixel 4
# new_float pixel 4

set $ws1 "1"
set $ws2 "2"
set $ws3 "3"
set $ws4 "4"
set $ws5 "5"
set $ws6 "6"
set $ws7 "7"
set $ws8 "8"
set $ws9 "9"
set $ws10 "10"

################################################################################
# --------------------------      KEYBINDINGS      --------------------------- #
################################################################################

bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split

bindsym $mod+Shift+c kill
bindsym Ctrl+q exec /bin/true

bindsym $mod+r mode "resize"
bindsym $mod+Shift+x reload
bindsym $mod+Shift+r restart
bindsym $mod+f fullscreen toggle

bindsym Ctrl+$mod+l exec i3lock-fancy -p
bindsym $mod+Return exec i3-sensible-terminal
bindsym $mod+Shift+f exec --no-startup-id flameshot gui
bindsym $mod+Shift+d exec dmenu_run
bindsym $mod+d exec --no-startup-id rofi -show run


################################################################################
# -------------------      TERMINAL STARTUP COMMANDS      -------------------- #
################################################################################

set $term "Termite"

set $i3_conf "nvim .config/i3/config"
set $pb_conf "nvim .config/polybar/config.ini"

set $rss "newsboat"

set $ncmpcpp "ncmpcpp -s visualizer"

set $htop "htop"
set $bashtop "bashtop"
set $gotop "gotop"


################################################################################
# ----------------------      ASSIGN TO WORKSPACES      ---------------------- #
################################################################################

# --- 1 ---
assign [class="LibreWolf"] $ws1


# --- 2 ---
assign [class="Tor Browser"] $ws2


# --- 3 ---
assign [class=$term title=$i3_conf] $ws3
assign [class=$term title=$pb_conf] $ws3


# --- 4 ---


# --- 5 ---


# --- 6 ---
assign [class="Transmission-gtk"] $ws6
assign [class="Pcmanfm"] $ws6


# --- 7 ---


# --- 8 ---
assign [class="discord"] $ws8
assign [class="Telegram"] $ws8


# --- 9 ---
# assign [class=$term title=$ncmpcpp] $ws9
assign [title="on QEMU/KVM"] $ws9


# --- 10 ---
assign [class=$term title=$htop] $ws10
assign [class="Virt-manager"] $ws10

assign [class=$term title=$bashtop] $ws10
assign [class=$term title=$gotop] $ws10


################################################################################
# ----------------------------      STARTUP      ----------------------------- #
################################################################################

# exec --no-startup-id telegram-desktop
# exec --no-startup-id librewolf
# exec --no-startup-id tor-browser

# exec --no-startup-id transmission-gtk
# exec --no-startup-id pcmanfm
exec --no-startup-id virt-manager 


exec --no-startup-id termite -t $i3_conf -e $i3_conf
exec --no-startup-id termite -t $pb_conf -e $pb_conf

# exec --no-startup-id termite -t $rss -e $rss

# exec --no-startup-id termite -t $ncmpcpp -e $ncmpcpp

exec --no-startup-id termite -t $htop -e $htop
# exec --no-startup-id termite -t $bashtop -e $bashtop
# exec --no-startup-id termite -t $gotop -e $gotop



exec --no-startup-id pcmanfm -d
exec --no-startup-id dunst
exec --no-startup-id clipit
exec --no-startup-id pasystray
exec --no-startup-id nm-applet
exec --no-startup-id blueman-tray
exec --no-startup-id cbatticon
exec --no-startup-id redshift-gtk 

exec_always --no-startup-id setxkbmap -layout us,ru
exec_always --no-startup-id setxkbmap -option 'grp:shifts_toggle'

exec --no-startup-id feh --bg-fill .wall/f.jpg
exec --no-startup-id xss-lock -l ~/.config/i3/transfer-sleep-lock-i3lock.sh -- i3lock-fancy -p
exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
exec --no-startup-id picom --config ~/.config/picom/config

exec_always --no-startup-id python3 $HOME/.config/i3/alternating_layouts.py
exec_always --no-startup-id $HOME/.config/polybar/launch.sh

# exec --no-startup-id xrandr -s 1920x1080


################################################################################
# --------------------------      WINDOW RULES      -------------------------- #
################################################################################

for_window [class="^.*"] border pixel $border
for_window [window_role="pop-up"] floating enable
for_window [window_role="task_dialog"] floating enable

for_window [class="GParted"] floating enable 
for_window [title="ranger"] floating enable 

set $virt_manager "^Virt-manager$"

for_window [class=$virt_manager] floating enable
for_window [class=$virt_manager] resize set 500 300 
for_window [class=$virt_manager] move absolute position 1400 700

for_window [title="on QEMU/KVM"] floating disable 

floating_modifier $mod
bindsym $mod+Shift+space floating toggle
bindsym $mod+space focus mode_toggle


################################################################################
# -----------------------      VOLUME & BACKLIGHT      ----------------------- #
################################################################################

bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5%
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5%
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle
bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle

bindsym XF86MonBrightnessUp exec "xbacklight -inc 10"
bindsym XF86MonBrightnessDown exec "xbacklight -dec 10"


################################################################################
# -----------------------------      OTHER      ------------------------------ #
################################################################################

mode "resize" {
    bindsym h resize shrink width $gs px or $gs ppt
    bindsym j resize grow height $gs px or $gs ppt
    bindsym k resize shrink height $gs px or $gs ppt
    bindsym l resize grow width $gspx or $gs ppt

    bindsym Left resize shrink width $gs px or $gs ppt
    bindsym Down resize grow height $gs px or $gs ppt
    bindsym Up resize shrink height $gs px or $gs ppt
    bindsym Right resize grow width $gs px or $gs ppt

    bindsym Return mode "default"
    bindsym Escape mode "default"
    bindsym $mod+r mode "default"
}

set $mode_gaps_inner Inner Gaps: +|-|0 (local), Shift + +|-|0 (global)
bindsym $mod+Shift+g mode "$mode_gaps_inner"

mode "$mode_gaps_inner" {
        bindsym plus  gaps inner current plus 5
        bindsym minus gaps inner current minus 5
        bindsym 0     gaps inner current set 0

        bindsym Shift+plus  gaps inner all plus 5
        bindsym Shift+minus gaps inner all minus 5
        bindsym Shift+0     gaps inner all set 0

        bindsym Return mode "default"
        bindsym Escape mode "default"
}


################################################################################
# ------------------------      DEFAULT SETTINGS      ------------------------ #
################################################################################

bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l focus right

bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right

bindsym $mod+Shift+h move left
bindsym $mod+Shift+j move down
bindsym $mod+Shift+k move up
bindsym $mod+Shift+l move right

bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right

bindsym $mod+1 workspace number $ws1
bindsym $mod+2 workspace number $ws2
bindsym $mod+3 workspace number $ws3
bindsym $mod+4 workspace number $ws4
bindsym $mod+5 workspace number $ws5
bindsym $mod+6 workspace number $ws6
bindsym $mod+7 workspace number $ws7
bindsym $mod+8 workspace number $ws8
bindsym $mod+9 workspace number $ws9
bindsym $mod+0 workspace number $ws10

# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace number $ws1
bindsym $mod+Shift+2 move container to workspace number $ws2
bindsym $mod+Shift+3 move container to workspace number $ws3
bindsym $mod+Shift+4 move container to workspace number $ws4
bindsym $mod+Shift+5 move container to workspace number $ws5
bindsym $mod+Shift+6 move container to workspace number $ws6
bindsym $mod+Shift+7 move container to workspace number $ws7
bindsym $mod+Shift+8 move container to workspace number $ws8
bindsym $mod+Shift+9 move container to workspace number $ws9
bindsym $mod+Shift+0 move container to workspace number $ws10
